class UserAssetsController < ApplicationController

  def upload_tester
    @user_asset = UserAsset.new
  end

  def create
    asset = UserAsset.new( params[:user_asset] )
    hash = params[:user_asset]
    hash[:image_file].path
    if asset.save
      redirect_to "http://localhost:3000/test/upload"
    else
      render :template => 'user_assets/upload_tester'
			#render :file=>"public/404.html", :status => 404
    end
  end

  def show
    @photo = UserAsset.find(params[:id])
  end

  def image
    @image_data = UserAsset.find_by_filename_and_ext_and_user_id(params[:filename], params[:ext], User.find_by_name(params[:user_name]).id)
    @image = @image_data.binary_data
    send_data(@image, :type => @image_data.content_type, :filename => @image_data.filename, :disposition => 'inline')
  end

end
